local skel = fk.CreateSkill {
  name = "emo__soulie",
}

Fk:loadTranslationTable{
  ["emo__soulie"] = "搜猎",
  [":emo__soulie"] = "出牌阶段限一次，你可以失去1点体力，依次重铸两种颜色的手牌。",

  ["#emo__soulie"] = "搜猎：你需失去1点体力，依次重铸两种颜色的手牌",
  ["#emo__soulie-choice"] = "请选择你要重铸的颜色",
}

skel:addEffect("active", {
  anim_type = "drawcard",
  prompt = "#emo__soulie",
  card_num = 0,
  target_num = 0,
  can_use = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
  end,
  times = function (self, player)
    return 1 - player:usedSkillTimes(skel.name, Player.HistoryPhase)
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    room:loseHp(player, 1, skel.name)
    local choices = {"black", "red"}
    while #choices > 0 do
      if player.dead or player:isKongcheng() then return end
      local list = {}
      for _, id in ipairs(player.player_cards[Player.Hand]) do
        local color = Fk:getCardById(id):getColorString()
        list[color] = list[color] or {}
        table.insert(list[color], id)
      end
      local chs = table.filter(choices, function (color)
        return list[color]
      end)
      if #chs == 0 then return end
      local choice = room:askToChoice(player, {
        choices = chs, prompt = "#emo__soulie-choice", skill_name = skel.name
      })
      table.removeOne(choices, choice)
      room:recastCard(list[choice], player, skel.name)
    end
  end,
})

return skel
